#ifndef __RF_PORT_H
#define __RF_PORT_H

#include "rf_trans.h"
#include "rf_pair.h"
#include "rf_sync.h"
#include "RingBuffer/lwrb.h"

enum rf_dev{
    RF_DEV_KBD,
    RF_DEV_MOUSE,

    RF_ALL_DEV,
};

enum rf_state {
    RF_DISCONNECTED,
    RF_CONNECTED
};

struct rf_port_dev {
    uint8_t dev;
    uint32_t *addr;
    uint16_t count_loss;
    bool is_lost;
    uint16_t reset_time;
};

struct rf_port_cb{
    void (* get_data_cb)(uint8_t *data, size_t len);
    void (*connect_state_changed)(uint8_t state);
};

int rf_port_load_data_irq(uint8_t type, uint8_t *user_data, size_t uesr_len);
int rf_port_send_request_irq(uint8_t dev);
void rf_port_init(uint8_t *buffer, size_t len, struct rf_port_cb *port_cb);
void rf_port_discon_dev();

extern lwrb_t rf_ringbuf_data;;
#endif /* __RF_PORT_H */
